from django.core.management.base import BaseCommand
from back.models import EnvironmentData, CardData

class Command(BaseCommand):
    help = '清除所有门禁系统数据'
    
    def handle(self, *args, **options):
        if input("确定要删除所有数据吗？(yes/no) ").lower() == 'yes':
            EnvironmentData.clear_all_data()
            CardData.clear_all_data()
            self.stdout.write(self.style.SUCCESS('成功清除所有数据'))
        else:
            self.stdout.write(self.style.WARNING('操作已取消'))